/*package com.centit.framework.ip.appversion.controller;

import com.alibaba.fastjson.JSONObject;
import com.centit.fileserver.client.DefaultFileClient;
import com.centit.fileserver.client.po.FileStoreInfo;
import com.centit.framework.components.CodeRepositoryUtil;
import com.centit.framework.core.dao.CodeBook;
import com.centit.framework.ip.appversion.po.AppVersion;
import com.centit.framework.ip.util.FileUploadUtil;
import com.centit.framework.ip.util.layuiResultUtil;
import com.centit.framework.security.model.CentitUserDetails;
import com.centit.jzgrz.po.CoalPlant;
import com.centit.support.algorithm.UuidOpt;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import com.centit.framework.ip.appversion.service.AppVersionManager;
	

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.alibaba.fastjson.JSONArray; 
import com.centit.framework.common.JsonResultUtils;
import com.centit.framework.common.ResponseMapData;
import com.centit.framework.core.controller.BaseController;
import com.centit.support.database.utils.PageDesc;

*//**
 * AppVersion  Controller.
 * create by scaffold 2018-09-12 
 * @author 脚手架，改成开发者的名字
 * App软件版本管理App软件版本管理   
*//*


@Controller
@RequestMapping("/appversion/appversion")
public class AppVersionController  extends BaseController {
	private static final Log log = LogFactory.getLog(AppVersionController.class);
    private static String uploaderpath= CodeRepositoryUtil.getSysConfigValue("uploaderpath");
	@Resource
	private AppVersionManager appVersionMag;
    private DefaultFileClient fileClient;

    *//**
     * 查询所有   App软件版本管理  列表
     *
     * @param field    json中只保存需要的属性名
     * @param request  {@link HttpServletRequest}
     * @param response {@link HttpServletResponse}
     * @return {data:[]}
     *//*
    @RequestMapping(method = RequestMethod.GET)
    public void list(String[] field, PageDesc pageDesc, HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> searchColumn = convertSearchColumn(request);
        String limit=request.getParameter("limit");//必要写法
        pageDesc.setPageSize(Integer.parseInt(limit));//设置参数
        searchColumn.put(CodeBook.SELF_ORDER_BY," to_number(versionno) desc");
        JSONArray jsonArrayObjects = appVersionMag.listObjectsAsJson( searchColumn, pageDesc);
         
        if (null == pageDesc) {
            JsonResultUtils.writeSingleDataJson(jsonArrayObjects, response);
            return;
        }
        
        ResponseMapData resData = new ResponseMapData();
        resData.addResponseData(OBJLIST, jsonArrayObjects);
        resData.addResponseData(PAGE_DESC, pageDesc);

        layuiResultUtil.layuiwriteResponseDataAsJson(resData, pageDesc, response);
    }
    *//**
     * 跳转到app版本页面
     *
     * @return
     *//*
    @RequestMapping(value = "/toForm",method = {RequestMethod.GET})
    public void toFormJsp(HttpServletRequest request, HttpServletResponse response) {
    	response.setHeader("X-Frame-Options", "SAMEORIGIN");
    	try {
            String recid =request.getParameter("recid");
            if(StringUtils.isNotBlank(recid)){
                AppVersion appVersion=appVersionMag.getObjectById(recid);
                request.setAttribute("appVersion",appVersion);
            }
            request.getRequestDispatcher("/modules/appversion/appversion-info.jsp").forward(request, response);
        } catch (ServletException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    *//**
     * 查询单个  App软件版本管理 
	
	 * @param recid  recId
     *  
     * 
     * @param response    {@link HttpServletResponse}
     * @return {data:{}}
     *//*
    @RequestMapping(value = "/selectone/{recid}", method = {RequestMethod.GET})
    public void getAppVersion(@PathVariable String recid,HttpServletRequest request, HttpServletResponse response) {
    	response.setHeader("X-Frame-Options", "SAMEORIGIN");
    	AppVersion appVersion =     			
    			appVersionMag.getObjectById(recid);
        request.setAttribute("appVersion",appVersion);
        try {
            request.getRequestDispatcher("/modules/appversion/appversion-view.jsp").forward(request, response);
        } catch (ServletException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    	AppVersion appVersion =     			
    			appVersionMag.getObjectById(recid);
        JsonResultUtils.writeSingleDataJson(appVersion, response);
    }
    *//**
     * 删除单个  App软件版本管理 
	
	 * @param recid  recId
     *//*
    @RequestMapping(value = "/delete/{recid}", method = {RequestMethod.POST})
    public void deleteAppVersion(@PathVariable String recid, HttpServletResponse response) {
        String message="操作成功";
        String code="0";
        try{
            appVersionMag.deleteObjectById( recid);
        }catch (Exception e){
            message=e.getMessage();
             code="1";
        }
    	JSONObject jsonObject=new JSONObject();
        jsonObject.put("message",message);
        jsonObject.put("code",code);
        
        JsonResultUtils.writeSingleDataJson(jsonObject,response);
    } 
    
    *//**
     * 新增或保存 App软件版本管理 
    
	 * @param appVersion  {@link AppVersion}
     * @param response    {@link HttpServletResponse}
     *//*
    @RequestMapping(value = "/save", method = {RequestMethod.POST})
    public void updateAppVersion(
    	@Valid AppVersion appVersion,HttpServletRequest request, HttpServletResponse response) {
        String message="操作成功";
        String code="0";
        try {
            CentitUserDetails userDetails=getLoginUser(request);
            String recid=appVersion.getRecid();
            AppVersion dbAppVersion  =null;
            if(StringUtils.isNotBlank(recid)){
                dbAppVersion  = appVersionMag.getObjectById( recid);
            }
            if (null != dbAppVersion) {//如果数据库数据存在，则是更新操作
                dbAppVersion .copyNotNullProperty(appVersion);//赋值页面不为空的值，小心页面空的字符串或者改写copyNotNullProperty方法，根据自己业务需要
                appVersion=dbAppVersion;
                appVersion.setUpdater(userDetails.getUserCode());
                appVersion.setUpdatetime(new Date());
                appVersionMag.mergeObject(dbAppVersion);
            } else {
                appVersion.setRecid(UuidOpt.getUuidAsString32());
                appVersion.setCreater(userDetails.getUserCode());
                appVersion.setCreatetime(new Date());
                appVersionMag.saveNewObject(appVersion);//新增,注意主键赋值 UuidUtil.getTimeBasedUuid()，填写自己的业务时间，业务操作人等信息
            }
        }catch (Exception e){
            message=e.getMessage();
            code="1";
        }
        JSONObject jsonObject=new JSONObject();
        jsonObject.put("message",message);
        jsonObject.put("code",code);
        JsonResultUtils.writeSingleDataJson(jsonObject,response);
    }
    *//**
     *
     * 功能描述: 二维码扫描下载
     *
     * @param:
     * @return:
     * @auther: 皇甫壮
     * @date: 2018-9-13 20:38
     *//*
    @RequestMapping(value = "/getMaxAppVersion", method = {RequestMethod.GET})
    public void getMaxAppVersion(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> searchColumn = convertSearchColumn(request);
        searchColumn.put(CodeBook.SELF_ORDER_BY," to_number(versionno) desc");
        JSONArray jsonArrayObjects = appVersionMag.listObjectsAsJson( searchColumn, null);
        JSONObject jsonObject=new JSONObject();
        if(jsonArrayObjects!=null&&jsonArrayObjects.size()>0){
            jsonObject=jsonArrayObjects.getJSONObject(0);
            fileClient= FileUploadUtil.getFileClient();
            String fileId=(String) jsonObject.get("fileid");
            if(StringUtils.isNotBlank(fileId)){
                try {
                    FileStoreInfo fileStoreInfo=fileClient.getFileStoreInfo(fileClient.getHttpClient(),fileId);
                    InputStream inputStream=FileUploadUtil.getInputStreamFromFileServer(fileId);
                   request.getRequestDispatcher("").forward(request,response);
                  response.sendRedirect(uploaderpath+"/service/download/pfile/"+fileId);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
        JsonResultUtils.writeSingleDataJson("文件不存在",response);
    }
}
*/